﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.SceneManagement.SceneManagerAPI
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

#nullable disable
namespace UnityEngine.SceneManagement
{
  /// <summary>
  ///   <para>Derive from this base class to provide alternative implementations to the C# behavior of specific SceneManagement.SceneManager methods.</para>
  /// </summary>
  public class SceneManagerAPI
  {
    private static SceneManagerAPI s_DefaultAPI = new SceneManagerAPI();

    internal static SceneManagerAPI ActiveAPI
    {
      get => SceneManagerAPI.overrideAPI ?? SceneManagerAPI.s_DefaultAPI;
    }

    /// <summary>
    ///   <para>The specific SceneManagement.SceneManagerAPI instance to use to handle overridden SceneManagement.SceneManager methods.</para>
    /// </summary>
    public static SceneManagerAPI overrideAPI { get; set; }

    protected internal SceneManagerAPI()
    {
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the SceneManagement.SceneManager.sceneCountInBuildSettings function.</para>
    /// </summary>
    /// <returns>
    ///   <para>Number of Scenes handled by SceneManagement.SceneManagerApi.GetSceneByBuildIndex.</para>
    /// </returns>
    protected internal virtual int GetNumScenesInBuildSettings()
    {
      return SceneManagerAPIInternal.GetNumScenesInBuildSettings();
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the SceneManagement.SceneManager.GetSceneByBuildIndex function.</para>
    /// </summary>
    /// <param name="buildIndex">Build index as returned by SceneManagement.SceneManagerApi.GetNumScenesInBuildSettings.</param>
    /// <returns>
    ///   <para>A reference to the Scene, if valid. If not, an invalid Scene is returned.</para>
    /// </returns>
    protected internal virtual Scene GetSceneByBuildIndex(int buildIndex)
    {
      return SceneManagerAPIInternal.GetSceneByBuildIndex(buildIndex);
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of the SceneManagement.SceneManager.LoadScene and SceneManagement.SceneManager.LoadSceneAsync functions.</para>
    /// </summary>
    /// <param name="sceneName"></param>
    /// <param name="sceneBuildIndex"></param>
    /// <param name="parameters"></param>
    /// <param name="mustCompleteNextFrame"></param>
    protected internal virtual AsyncOperation LoadSceneAsyncByNameOrIndex(
      string sceneName,
      int sceneBuildIndex,
      LoadSceneParameters parameters,
      bool mustCompleteNextFrame)
    {
      return SceneManagerAPIInternal.LoadSceneAsyncNameIndexInternal(sceneName, sceneBuildIndex, parameters, mustCompleteNextFrame);
    }

    protected internal virtual AsyncOperation UnloadSceneAsyncByNameOrIndex(
      string sceneName,
      int sceneBuildIndex,
      bool immediately,
      UnloadSceneOptions options,
      out bool outSuccess)
    {
      return SceneManagerAPIInternal.UnloadSceneNameIndexInternal(sceneName, sceneBuildIndex, immediately, options, out outSuccess);
    }

    /// <summary>
    ///   <para>Override for customizing the behavior of loading the first Scene in a stub player build.</para>
    /// </summary>
    /// <param name="mustLoadAsync"></param>
    protected internal virtual AsyncOperation LoadFirstScene(bool mustLoadAsync)
    {
      return (AsyncOperation) null;
    }
  }
}
